package com.wonders.common.parse.jaxb.handler;

import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.ValidationEvent;
import javax.xml.bind.ValidationEventHandler;

/**
 * 校验处理者
 * 
 * @author WuBin
 * 
 */
public class GreedyValidationEventHandler implements ValidationEventHandler {

	private List<ValidationEvent> events = new ArrayList<ValidationEvent>();

	public boolean handleEvent(ValidationEvent event) {
		events.add(event);
		return true;
	}

	public boolean hasEvents() {
		if (events == null || events.size() <= 0) {
			return false;
		} else {
			return true;
		}
	}

	public List<ValidationEvent> getEvents() {
		return events;
	}

	public void clearValidationResults() {
		events.clear();
	}
}
